package com.lunhui.service.lunhui.service.business.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.lunhui.cache.client.LoginUserCacheClient;
import com.lunhui.cache.client.RoseCacheClient;
import com.lunhui.cache.client.model.LoginUserDto;
import com.lunhui.cache.client.model.RoseCacheDto;
import com.lunhui.service.lunhui.service.business.CacheService;
import org.springframework.stereotype.Service;

/**
 * @author renminghe-kg
 */
@Service("cacheService")
public class CacheServiceImpl implements CacheService {
    @Reference
    private LoginUserCacheClient loginUserCacheClient;

    @Reference
    private RoseCacheClient roseCacheClient;

    @Override
    public void addLoginUserCache(LoginUserDto loginUserDto) {
        loginUserCacheClient.addLoginUserInfo(loginUserDto);
    }

    @Override
    public LoginUserDto getLoginUserCacheByUserId(Integer userId) {
        return loginUserCacheClient.getLoginUserCacheByUserId(userId);
    }

    @Override
    public Integer saveToDB(RoseCacheDto roseCacheDto) {
        return roseCacheClient.saveToDB(roseCacheDto);
    }
}